/**
 * table-mgr.js
 */

define('table-mgr',['jquery','base','liger.messageBox','liger.dialog','liger.all'],function(require, exports, module){
	var Base = require("base");
	var $ = require("jquery");
	require("liger.all")($);
	var ctx = Base.common.utils.getContextPath();
	
	var $roleList = $("#dataGrid").ligerGrid({
		url: ctx + "/role/fetch.do",
		root:'datas',
        columns: [ { display: '主键', hide: true, name:'id', align:'left', width: 120 } ,
        { display: '角色名称', name: 'name', minWidth: 80 },
        { display: '类型', name: 'type', width: 150, align: 'left',render:function (rowData, index, value){
        	rowData.type_real = rowData.type;
        	value = typeEnum[rowData.type];
        	return value;
        }}
        ], data: [], pageSize: 20, sortName: 'name',
		width : '98%',
		height : '98%',
		checkbox : true,
		rownumbers : false,
		isScroll : true,
		toolbar:{ items: [ { text: '增加', click: add , icon:'add'}, { line:true },
                          { text: '修改', click: modify }, { line:true },
                          { text: '删除', click: del }, { line:true },
                          { text: '分配权限', click: dispathAuthority } ]
                      },
        fixedCellHeight: false

    });
    $("#pageloading").hide();
    
    /**
     * 
     */
    function add(){
    	$.ligerDialog.success('添加');
    }  
    

    /**
     * 分发权限
     */
    function dispathAuthority(){
    	
    	$.ligerDialog.open({
			height : 500,
			url : ctx+'/custom/authority-mgr.jsp',
			width : 900,
			showMax : true,
			showToggle : true,
			showMin : true,
			isResize : true,
			slide : true,
			title:'添加权限'
		}); 
    	
    	
    }

});